<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>index</title>
</head>
<body>
    <h2>index</h2>
    <br>
    <a th:href="@{/testRequestBody}">testRequestBody</a><br>
    <form th:action="@{/testRequestBody}" method="post">
        姓名：<input type="text" name="name"><br>
        密码：<input typeof="password" name="password"><br>
        <input type="submit" value="测试@RequestBody"><br>
    </form>
    <form th:action="@{/testRequestEntity}" method="post">
        姓名：<input type="text" name="name"><br>
        密码：<input typeof="password" name="password"><br>
        <input type="submit" value="测试@testRequestEntity"><br>
    </form>

    <hr>
    <a th:href="@{/testResponse}">testResponse</a><br>
    <a th:href="@{/testResponseBody}">testResponseBody</a><br>
    <a th:href="@{/testResponseBody_user_json}">testResponseBody_user_json</a><br>
    <HR>

    <div id="app">
        <a @click="testAxios" th:href="@{/testAxios}">springmvc处理Ajax</a>
    </div>

    <hr><hr>
    <!--拦截器-->
    <a th:href="@{/testInterceptor}">testInterceptor</a>

    <!--引入vue和Axios文件（远程）-->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.0-beta.7/vue.cjs.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

    <!--ajax测试-->
    <script type="text/javascript">
        // alert("test 是否进入js")
        new Vue({
            el:"#app",
            methods:{
                testAxios:function (event) {
                    axios({
                       method:"post",
                        url:event.target.href,
                        params:{
                           name:"feng",
                            age:18
                        }
                    }).then(function (response) {
                        alert(response.data);
                    });
                    event.preventDefault();
                }
            }
        });
    </script>
</body>
</html>